<template>
	<view class="department-intro card-page">
		<RegisterListHeader />
		<view class="department-intro-main">
      <view class="title">
        {{routeParams.deptName}}
      </view>
      
      <view class="hospital-info">
        <h3 class="hospital-name">{{ routeParams.name }}</h3>
        <p class="hospital-address">
          <i class="fas fa-map-marker-alt"></i>
          科室位置: {{ routeParams.address }}
        </p>
        <p class="hospital-phone">
          <i class="fas fa-phone-alt"></i>
          科室电话: {{ routeParams.phone }}电话
        </p>
      </view>
      
			<view class="department-intro-main-text">
				<rich-text :nodes="routeParams.introductionHtml"></rich-text>
			</view>
			<!-- <view class="department-intro-main-btn flexC">
				<view @click="rePage">去挂号</view>
			</view> -->
		</view>
		<Load :load="load" />
	</view>
</template>

<script>
	import RegisterListHeader from '@/components/RegisterListHeader/index.vue'
	import { themeColorLight } from '@/static/js/theme.js'
	import { transHtml } from '@/common/js/common.js'
	import Load from '@/components/Load/index.vue'
	import { getDeptList } from '@/api/otherService.js'
	import { mapGetters } from 'vuex'
	export default {
		components:{ RegisterListHeader, Load },
		data() {
			return {
				themeColorLight,
				deptCode:null,
				load:true,
				routeParams:{},
			}
		},
		computed:{
			...mapGetters([])
		},
		onLoad(op) {
			this.deptCode = op.deptCode||''
			this.initData()
		},
		methods: {
			initData(){
				let params = {
					deptCode:this.deptCode
				}
				getDeptList(params).then(data => {
				
					this.load = false;
					let res = data&&data[0];
					if(res){
						res.introductionHtml = transHtml(res.introduction)
					}else{
						res.introductionHtml = transHtml('暂无介绍')
					}
					this.routeParams = res
				}).catch(e => {
					this.routeParams = ''
					this.load = false
				})
			},
			rePage(){
				uni.navigateTo({
					url:'/pages/registerPblist/index?deptCode=' + this.deptCode
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.department-intro-main{
		height: calc(100vh - 310rpx - 10rpx );
		overflow: scroll;
		margin-top: 24rpx;
		padding: 30rpx;
		background-color: $uni-bg-color;
		>image{
			margin-bottom: 30rpx;
			width: 100%;
			height: 300rpx;
		}
		.department-intro-main-text{
      font-family: PingFang SC, PingFang SC;
      font-weight: 300;
      font-size: 28upx;
      color: rgba(0,0,0,0.7);
      line-height: 44upx;
			// color: $text-color-grey;
			padding: 30rpx 0;
			// 310 医院信息高度 
			// max-height: calc(100vh - 310rpx - 330rpx );
			max-height: calc(100% - 48upx);
			overflow: scroll;
		}
		.department-intro-main-btn{
			margin-top: 10rpx;
			height: 90rpx;
			justify-content: center;
			align-items: center;
			background-color: $theme-color-light;
			font-size: 34rpx;
			color: $text-color-fff;
		}
	}
  .title {
    font-family: PingFang SC, PingFang SC;
    font-weight: 500;
    font-size: 36upx;
    color: rgba(0,0,0,0.8);
    text-align: center;
  }
</style>